home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / forth.lang < prev    next >
Extensible Markup Language  |  2008-09-09  |  9KB  |  235 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: Jens-Hanno Schwalm  <hanno@schwalm-bremen.de>
  5.  Copyright (C) 2007 Jens-Hanno Schwalm; <hanno@schwalm-bremen.de>
  6.  
  7.  This library is free software; you can redistribute it and/or
  8.  modify it under the terms of the GNU Library General Public
  9.  License as published by the Free Software Foundation; either
  10.  version 2 of the License, or (at your option) any later version.
  11.  
  12.  This library is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  Library General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU Library General Public
  18.  License along with this library; if not, write to the
  19.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  Boston, MA 02111-1307, USA.
  21.  
  22. -->
  23. <language id="forth" _name="Forth" version="2.0" _section="Sources">
  24.   <metadata>
  25.     <property name="mimetypes">text/x-forth</property>
  26.     <property name="globs">*.frt;*.fs</property>
  27.     <property name="line-comment-start">\</property>
  28.     <property name="block-comment-start">(*</property>
  29.     <property name="block-comment-end">*)</property>
  30.   </metadata>
  31.  
  32.   <styles>
  33.     <style id="comment"       _name="Comment"       map-to="def:comment"/>
  34.     <style id="string"        _name="String"        map-to="def:string"/>
  35.     <style id="preprocessor"  _name="Preprocessor"  map-to="def:preprocessor"/>
  36.     <style id="keyword"       _name="Keyword"       map-to="def:statement"/>
  37.     <style id="type"          _name="Data Type"     map-to="def:type"/>
  38.     <style id="number"        _name="Number"        map-to="def:decimal"/>
  39.     <style id="debugs"        _name="Debug Code"    map-to="def:comment"/>
  40.     <style id="error"         _name="Error text"    map-to="def:error"/>
  41.     <style id="compiler"      _name="Compiler opt"  map-to="def:identifier"/>
  42.   </styles>
  43.  
  44.   <default-regex-options case-sensitive="false"/>
  45.  
  46.   <definitions>
  47.     <context id="forth">
  48.       <include>
  49.         <!--        single line comments                        \        \G        -->
  50.         <context id="comment" style-ref="comment" end-at-line-end="true">
  51.           <start>(?<![^\s])(\\|--|\\G)(?![^\s])</start>
  52.           <include>
  53.             <context ref="def:in-line-comment"/>
  54.           </include>
  55.         </context>
  56.  
  57.         <!--        multiline comments ending with ")"        (        (S        (F        -->
  58.         <context id="comment-multiline" style-ref="comment">
  59.           <start>(?<![^\s])(\(|\(S|\(F)(?![^\s])</start>
  60.           <end>\)</end>
  61.           <include>
  62.             <context ref="def:in-comment"/>
  63.           </include>
  64.         </context>
  65.  
  66.         <!--        multiline comment (* ....*)        -->
  67.         <context id="comment-multiline2" style-ref="comment">
  68.           <start>(?<![^\s])\(\*(?![^\s])</start>
  69.           <end>\*\)(?![^\s])</end>
  70.           <include>
  71.             <context ref="def:in-comment"/>
  72.           </include>
  73.         </context>
  74.  
  75.         <!--        multiline comment DOC ... ENDDOC        -->
  76.         <context id="comment-multiline3" style-ref="comment">
  77.           <start>(?<![^\s])DOC(?![^\s])</start>
  78.           <end>(?<![^\s])ENDDOC(?![^\s])</end>
  79.           <include>
  80.             <context ref="def:in-comment"/>
  81.           </include>
  82.         </context>
  83.  
  84.         <!--        preprocessor instructions followed by a string        -->
  85.         <context id="preproc1" style-ref="preprocessor">
  86.           <match extended="true">
  87.             (?<![^\s])
  88.             (NEEDS|INCLUDE|IN|MARKER)\s+[^\s]*
  89.             (?![^\s])
  90.           </match>
  91.         </context>
  92.  
  93.         <!--        REVISION instruction is followed by a filename plus a string between "..."        -->
  94.         <context id="preproc2" style-ref="preprocessor">
  95.           <match extended="true">
  96.             (?<![^\s])
  97.             (REVISION)\s+[^\s]*\s*".*"
  98.             (?![^\s])
  99.           </match>
  100.         </context>
  101.  
  102.         <!--        preprocessor instructions        -->
  103.         <context id="preproc3" style-ref="preprocessor">
  104.           <match extended="true">
  105.             (?<![^\s])
  106.             (INCLUDED|INCLUDE-FILE)
  107.             (?![^\s])
  108.           </match>
  109.         </context>
  110.  
  111.         <!--        all defining or compiler extension words are followed by another whitespace delinited word        -->
  112.         <context id="definers" style-ref="type">
  113.           <match extended="true">
  114.             (?<![^\s])
  115.             (POSTPONE|\[COMPILE\]|\[CHAR\]|\['\]|COMPILE|CHAR|[DFT]?VALUE|[2FT]?VARIABLE|[DS]?FVARIABLE|[T]?USER|[T]?CODE|[DZFT]?LOCAL|
  116.             [2FT]?CONSTANT|TCONSTANT-|TSUB|=\:|==\:|DEFER|HC\:|[VHTM]?\:)\s+[^\s]+
  117.             (?![^\s])
  118.           </match>
  119.         </context>
  120.  
  121.         <!--        the grouped local words like LOCALS| read words until a last |        -->
  122.         <context id="locals" style-ref="type">
  123.           <match extended="true">
  124.             (?<![^\s])
  125.             ([DFZ]?LOCALS)\|\s+[^\|]+[\|]
  126.             (?![^\s])
  127.           </match>
  128.         </context>
  129.  
  130.         <!--        strings ended by a "                S"        ."        EVAL"        C"        Z"        -->
  131.         <context id="string" style-ref="string" end-at-line-end="true">
  132.           <start>(?<![^\s])(S|[.]|EVAL|C|Z|,)"\s</start>
  133.           <end>"</end>
  134.          </context>
  135.  
  136.         <!--        strings ended by a ~ character when " is inside a string:        .~        -->
  137.         <context id="string2" style-ref="string" end-at-line-end="true">
  138.           <start>(?<![^\s])(.~)\s</start>
  139.           <end>~</end>
  140.          </context>
  141.  
  142.         <!--        comment string  .( ..)        -->
  143.         <context id="string3" style-ref="string" end-at-line-end="true">
  144.           <start>(?<![^\s])[.]\(\s</start>
  145.           <end>\)</end>
  146.          </context>
  147.  
  148.         <!--        error strings ending with "                ABORT"        ?ERROR"        -->
  149.         <context id="errorstring" style-ref="error" end-at-line-end="true">
  150.           <start>(?<![^\s])(ABORT|\?ERROR)"\s</start>
  151.           <end>"</end>
  152.          </context>
  153.  
  154.         <!--        represent numbers including the hex, decimal and binary prefixes, also short characters        -->
  155.         <context id="number" style-ref="number">
  156.           <match extended="true">
  157.             (?<![^\s])
  158.             ([$][-+]?[A-F0-9.]+ |
  159.              [#][-+]?[0-9.]+ |
  160.              [%][-+]?[0-1.]+ |
  161.              [-+]?[0-9.]+ |
  162.              [-+]?[0-9]+[.]?[0-9]*[eE][0-9]* |
  163.              '[^\s]' |
  164.              [\^][A-Za-z] |
  165.              TRUE |
  166.              FALSE)
  167.             (?![^\s])
  168.           </match>
  169.         </context>
  170.  
  171.         <!--        Control flow Keywords -->
  172.         <context id="keywords" style-ref="keyword">
  173.           <match extended="true">
  174.             (?<![^\s])
  175.             (\[IF\]|\[ELSE\]|\[THEN\]|\[DEFINED\]|\[UNDEFINED\]|\?DEF|\?UNDEF|THROW|CASE|ENDCASE|OF|ENDOF|FOR|NEXT|
  176.                     IF[,]?|ELSE[,]?|THEN[,]?|ENDIF[,]?|BEGIN[,]?|WHILE[,]?|REPEAT[,]?|UNTIL[,]?|AGAIN[,]?|DO|LOOP|\?DO|\+LOOP|LEAVE|\?LEAVE|UNLOOP|EXIT|\?EXIT|
  177.                     PAR|ENDPAR|STARTP|ENDP)
  178.             (?![^\s])
  179.           </match>
  180.         </context>
  181.  
  182.         <!--        Compiler modifications -->
  183.         <context id="keywords2" style-ref="compiler">
  184.           <match extended="true">
  185.             (?<![^\s])
  186.             (PRIVATE|PRIVATES|DEPRIVE|FORGET|IMMEDIATE|ALSO|ONLY|FORTH|DEFINITIONS|HEADERLESS)
  187.             (?![^\s])
  188.           </match>
  189.         </context>
  190.  
  191.         <!--        Defining keywords without displaying the following word        -->
  192.         <context id="keywords3" style-ref="type">
  193.           <match extended="true">
  194.             (?<![^\s])
  195.             (\:ABOUT|DOES>|FORGET>|CREATE|\:NONAME)
  196.             (?![^\s])
  197.           </match>
  198.         </context>
  199.  
  200.         <!--        <<DEBUG        ..... DEBUG>> -->
  201.         <context id="comment-debug" extend-parent="false" style-ref="debugs">
  202.           <start>(?<![^\s])(<<DEBUG)(?![^\s])</start>
  203.           <end>(?<![^\s])(DEBUG>>)(?![^\s])</end>
  204.           <include>
  205.             <context ref="keywords"/>
  206.             <context ref="keywords2"/>
  207.             <context ref="keywords3"/>
  208.             <context ref="number"/>
  209.             <context ref="comment"/>
  210.             <context ref="string" />
  211.             <context ref="string2" />
  212.             <context ref="string3" />
  213.             <context ref="errorstring" />
  214.             <context ref="locals" />
  215.             <context ref="definers" />
  216.             <context ref="comment-multiline"/>
  217.           </include>
  218.         </context>
  219.  
  220.         <!--        [ ... ] is displayed as a preprocessor structure        -->
  221.         <context id="preproc4" extend-parent="true" style-ref="preprocessor">
  222.           <start>(?<![^\s])(\[)(?![^\s])</start>
  223.           <end>(?<![^\s])(\])(?![^\s])</end>
  224.           <include>
  225.             <context ref="keywords"/>
  226.             <context ref="number"/>
  227.             <context ref="comment"/>
  228.             <context ref="comment-multiline"/>
  229.           </include>
  230.         </context>
  231.       </include>
  232.     </context>
  233.   </definitions>
  234. </language>
  235.